﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Threading;
using System.Threading.Tasks;
using System.Diagnostics;

namespace testParallelFx
{
    class Program
    {
        static void Main(string[] args)
        {
            var watch = Stopwatch.StartNew();
            for (int i = 2; i < 20; i++)
            {
                var result = SumRootN(i);
                Console.WriteLine("root {0} : {1} ", i, result);
            }

            //Parallel.For(2, 20, (i) =>
            //{
            //    var result = SumRootN(i);
            //    Console.WriteLine("root {0} : {1} ", i, result);
            //});

            Console.WriteLine(watch.ElapsedMilliseconds);
            Console.ReadLine();
        }

        public static double SumRootN(int root)
        {
            double result = 0;
            for (int i = 1; i < 10000000; i++)
            {
                result += Math.Exp(Math.Log(i) / root);
            }

            return result;
        }
    }
}
